//
//  HLHomeCellPicturesViewCell.m
//  weibo-OC
//
//  Created by 黄力 on 15/12/21.
//  Copyright © 2015年 HLTest. All rights reserved.
//

#import "HLHomeCellPicturesViewCell.h"
#import <Masonry.h>
#import <UIImageView+WebCache.h>

@interface HLHomeCellPicturesViewCell ()

//图片
@property (nonatomic,strong) UIImageView *backImageView;

@end

@implementation HLHomeCellPicturesViewCell

//重写构造方法
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        //设置界面
        [self setupUI];
    }
    return self;
}

//设置界面
- (void)setupUI {
    //添加子控件
    [self.contentView addSubview:self.backImageView];
    //设置约束
    [self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}

//重写setter方法
- (void)setImageUrl:(NSURL *)imageUrl {
    _imageUrl = imageUrl;
    //给子控件设置数据
    [self.backImageView sd_setImageWithURL:imageUrl];
}

#pragma mark - 懒加载
//图片
- (UIImageView *)backImageView {
    if (_backImageView == nil) {
        _backImageView = [[UIImageView alloc] init];
        //设置内容的填充莫斯
        _backImageView.contentMode = UIViewContentModeScaleAspectFill;
        //设置剪切超出部分
        _backImageView.clipsToBounds = YES;
    }
    return _backImageView;
}

@end
